import Vue from 'vue';
import Router from 'vue-router';
import login from '@/page/login/login';
import manage from '@/page/manage/manage';

import welcome from '@/page/welcome/welcome'; // 首页
import userlist from '@/page/usermanage/userlist/userlist'; // 用户列表
import userdetail from '@/page/usermanage/userdetail/userdetail'; // 用户详情
import reportuser from '@/page/usermanage/reportuser/reportuser'; // 举报用户
import homepagebanner from '@/page/homemanage/homepagebanner/homepagebanner'; // 主页banner
import homepagerecommend from '@/page/homemanage/homepagerecommend/homepagerecommend'; // 主页推荐
import topicbanner from '@/page/topicmanage/topicbanner/topicbanner'; // 话题banner
import topicmanagesub from '@/page/topicmanage/topicmanagesub/topicmanagesub'; // 话题管理
import dailyoptimal from '@/page/topicmanage/dailyoptimal/dailyoptimal'; // 每日优选
import hottopic from '@/page/topicmanage/hottopic/hottopic'; // 热门话题
import hashtag from '@/page/topicmanage/hashtag/hashtag'; // 话题标签

import modules from './modules';

Vue.use(Router);

export const RouterMap = [
  {
    path: '/', // 首页
    redirect: '/login' // 重定向到login
  },
  {
    path: '/login', // 登录页面
    component: login
  },
  {
    path: '/manage', // 登录成功到manage
    component: manage,
    children: [
      {
        path: '', // 显示首页内容
        component: welcome
      },
      {
        path: '/userlist', // 用户列表
        component: userlist
      },
      {
        path: '/userlist/userdetail', // 用户详情
        component: userdetail
      },
      {
        path: '/reportuser', // 举报用户
        component: reportuser
      },
      {
        path: '/reportuser/userdetail', // 用户详情
        component: userdetail
      },
      {
        path: '/homepagebanner', // 主页banner
        component: homepagebanner
      },
      {
        path: '/homepagerecommend', // 主页推荐
        component: homepagerecommend
      },
      {
        path: '/topicbanner', // 话题banner
        component: topicbanner
      },
      {
        path: '/topicmanagesub', // 话题管理
        component: topicmanagesub
      },
      {
        path: '/dailyoptimal', // 每日优选
        component: dailyoptimal
      },
      {
        path: '/hottopic', // 热门话题
        component: hottopic
      },
      {
        path: '/hashtag', // 话题标签
        component: hashtag
      }
    ]
  }
];

export default new Router({
  mode: 'history', // 匹配history模式，路由路径好看
  routes: RouterMap
});
